package org.shilong.MLogic.Json.Friend;

import java.util.ArrayList;
import java.util.List;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import org.shilong.Model.FriendModel;

public class QueryWeiboFriend4JsonLogic {

	private static JSONObject jObject = null;

	private static JSONArray jArr = null;


	private static List<FriendModel> mList = null;


	public static List<FriendModel> getRlt( Object req ){

		jObject = null;

		mList = null;

		jArr = null;
		
		System.out.println( "传入的json值是:" +  req.toString());

		mList = new ArrayList<FriendModel>();
		try {
			jObject = new JSONObject( (String)req );

			jArr = jObject.getJSONArray( "rlt" );

			for( int i = 0; i < jArr.length(); i++ ){

				JSONObject oo = jArr.getJSONObject( i );

				FriendModel model = new FriendModel();

				model.setDescription( oo.getString("description") );
				model.setLocation( oo.getString("location"));
				model.setProfile_image_url( oo.getString( "image_url" ));
				model.setScreen_name( oo.getString("screen_name"));
				model.setWeibo_id( oo.getString( "weibo_id" ));

				
				mList.add(model);

			}
		} catch (JSONException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

		return mList;
	}

}
